package J11_9.J11_8;

import J11_9.J11_8.book.BookList;
import J11_9.J11_8.user.AdminUser;
import J11_9.J11_8.user.NormalUser;
import J11_9.J11_8.user.User;

import java.util.Scanner;

public class Main {

    public static User login() {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = in.nextLine();
        System.out.println("请选择你的身份：1-》管理员 2-》用户");
        int choose = in.nextInt();

        if(choose == 1) {
            //管理员
            return new AdminUser(name);
        }else {
            //用户
            return new NormalUser(name);
        }
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();

        User user = login();

        while(true) {

            int choice = user.menu();

            user.iOperations[choice].work(bookList);
        }


    }
}
